home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1995 #5 & #6
/
Amiga Plus CD - 1995 - No. 5 and 6.iso
/
pd
/
netz
/
term
/
extras
/
source
/
gtlayout-source.lha
/
LT_IMsg.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-06-11
|
3KB
|
104 lines
/* GadTools layout toolkit
**
** Copyright © 1993-1995 by Olaf `Olsen' Barthel
** Freely distributable.
*/
#include "gtlayout_global.h"
#define MESSAGE_COOKIE 0x19138AFB
struct IntuiMessage * LIBENT
LT_GetIMsg(REG(a0) struct LayoutHandle *Handle)
{
if(Handle)
{
struct IntuiMessage *Msg = GT_GetIMsg(Handle -> Window -> UserPort);
if(Msg)
{
struct IntuiMessage *Clone;
// For multiple handles sharing the same UserPort
if(Msg -> IDCMPWindow -> UserData && !((ULONG)Msg -> IDCMPWindow -> UserData & 1))
{
LayoutHandle *Local = (LayoutHandle *)Msg -> IDCMPWindow -> UserData;
if(Local -> PointBack == Local)
Handle = Local;
else
return(Msg);
}
else
return(Msg);
if(Msg -> Class == IDCMP_SIZEVERIFY && Handle -> ResizeView)
{
// They're coming to take me away, HAHA!
Handle -> SizeVerified = TRUE;
Handle -> SizeWidth = Handle -> Window -> Width;
Handle -> SizeHeight = Handle -> Window -> Height;
RemoveGList(Handle -> Window,Handle -> List,(UWORD)-1);
// Fake a null event, otherwise the following
// IDCMP_NEWSIZE would probably not get through
if(Clone = (struct IntuiMessage *)AllocMem(sizeof(struct IntuiMessage),MEMF_ANY))
{
CopyMem(Msg,Clone,sizeof(struct IntuiMessage));
Clone -> Class = NULL;
Clone -> ExecMessage . mn_Node . ln_Name = (char *)MESSAGE_COOKIE;
Clone -> ExecMessage . mn_Node . ln_Pri = -114;
Clone -> ExecMessage . mn_ReplyPort = (struct MsgPort *)Clone;
Clone -> SpecialLink = (struct IntuiMessage *)Clone;
GT_ReplyIMsg(Msg);
}
}
else
{
if(Clone = (struct IntuiMessage *)AllocMem(sizeof(struct IntuiMessage),MEMF_ANY))
{
CopyMem(Msg,Clone,sizeof(struct IntuiMessage));
Clone -> ExecMessage . mn_Node . ln_Name = (char *)MESSAGE_COOKIE;
Clone -> ExecMessage . mn_Node . ln_Pri = -114;
Clone -> ExecMessage . mn_ReplyPort = (struct MsgPort *)Clone;
Clone -> SpecialLink = (struct IntuiMessage *)Clone;
GT_ReplyIMsg(Msg);
LT_HandleInput(Handle,Clone -> Qualifier,&Clone -> Class,&Clone -> Code,(struct Gadget **)&Clone -> IAddress);
}
}
if(Clone)
return(Clone);
else
GT_ReplyIMsg(Msg);
}
}
return(NULL);
}
/*****************************************************************************/
VOID LIBENT
LT_ReplyIMsg(REG(a0) struct IntuiMessage *Msg)
{
if(Msg)
{
if(Msg -> SpecialLink == (struct IntuiMessage *)Msg && Msg -> ExecMessage . mn_Node . ln_Name == (char *)MESSAGE_COOKIE && Msg -> ExecMessage . mn_Node . ln_Pri == -114 && Msg -> ExecMessage . mn_ReplyPort == (struct MsgPort *)Msg)
FreeMem(Msg,sizeof(struct IntuiMessage));
else
GT_ReplyIMsg(Msg);
}
}